<template>
  <div id="ranking-board">
    <div class="ranking-board-title">小米商城类别数量</div>
    <dv-scroll-ranking-board :config="{
      data: configList,
      unit: '类',
      rowNum: 8
    }" />
  </div>
</template>

<script>
import { getPromoProduct } from '@/api/index'

export default {
  name: 'RankingBoard',
  data () {
    return {
      ProductList: ['手机','电视机','空调','洗衣机','保护套','保护膜','充电器','充电宝'],
      configList: []
    }
  },
  methods: {
    createData () {
      let dataList = [] 
      this.ProductList.forEach(element => {
        getPromoProduct({
          categoryName: element
        }).then(res=>{
          console.log(element, res.Product.length);

          this.configList.push({
            name: element,
            value: res.Product.length
          })
        })
      });

    }
  },
  created () {
    this.createData()
  }
}
</script>

<style lang="less">
#ranking-board {
  width: 20%;
  box-shadow: 0 0 3px blue;
  display: flex;
  flex-direction: column;
  background-color: rgba(6, 30, 93, 0.5);
  border-top: 2px solid rgba(1, 153, 209, .5);
  box-sizing: border-box;
  padding: 0px 30px;

  .ranking-board-title {
    font-weight: bold;
    height: 50px;
    display: flex;
    align-items: center;
    font-size: 20px;
  }

  .dv-scroll-ranking-board {
    flex: 1;
  }
}
</style>
